package edu.ccut.saturn.basecomponent.database.preparedstatement.impl;

import java.io.StringReader;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import edu.ccut.saturn.basecomponent.database.preparedstatement.IPreparedStatementSet;

public class PreparedStatementSetCharacterStream implements
		IPreparedStatementSet {

	public void setValue(PreparedStatement statement, int i, Object value)
			throws SQLException {
		
		StringReader stringReader = null;
		
		try {
			stringReader = new StringReader((String) value);
					
			int length = ((String) value).length();
			
			statement.setCharacterStream(i, stringReader, length);
			
		} catch (Exception e) {
			e.printStackTrace();
		} 
		//TODO stringReader 没关
//		finally{
//			if(stringReader != null){
//				stringReader.close();
//				if(stringReader == null){
//					System.out.println("it is null");
//				}
//			}
//		}
	}

}
